<?php
//Zend_Loader::loadFile('../application/admin/models/Template.php');
class Roomcats 
{
    /**
     * @var object Zend DB Adapter
     */
    private $_db;
    /**
     * @var string
     */
   
    public function __construct()
    {
			$this->_db = Zend_Registry::get('db');
    }
    
    public function listroomcats()
    {
    	$listroomcats = $this->_db->fetchAll("
			select* from roomcategories
			
		");
		
		return $listroomcats;
	}
	
   public function getRoomcatsbyhotel($hotel_id)
    {
    	$listroomcatsbyhotel = $this->_db->fetchAll("
			select roomcat_id from hotelrooms where hotel_id=".$hotel_id."	
		");
		
		return $listroomcatsbyhotel;
	}
	
	public function addRoomcats($roomcats_dsc,$is_enabled)
	{
		$sql="insert into roomcategories  (roomcat_dsc,is_enable) values ('".$roomcats_dsc."',".$is_enabled.")";
		
		// echo $sql;exit;
		
		$addNewsletters = $this->_db->exec($sql);
		return $addNewsletters;
		
	}
	

    public function getRoomcats($roomcat_id)
    {
    	//echo $hotel_id;exit;
    $sql="
			select *
			from  roomcategories where   roomcat_id='".$roomcat_id."'
			
		";
  // echo $sql;exit;
    	$getHotel = $this->_db->fetchrow($sql);
	//print_r($getHotel);exit;
		return $getHotel;
       
    }
  public function updateRoomcats($roomcat_id,$roomcats_dsc,$is_enabled){
  	$sql="update roomcategories set  roomcat_dsc='".$roomcats_dsc."',is_enable=".$is_enabled." where roomcat_id=".$roomcat_id."";
		
	 //echo $sql;exit;
		
		$editroomcats = $this->_db->exec($sql);
		return $editroomcats;
  	
  }
  
  public function deleteRoomcats($roomcat_id)
  {
  	$sql="delete from  roomcategories  where roomcat_id=".$roomcat_id."";
		
	 //echo $sql;exit;
		
		$deleteroomcats = $this->_db->exec($sql);
		return $deleteroomcats;
  	
  }
    
 
}

